Skip to main content

Installation

OpenCLIP can be installed in multiple ways depending on your use case. This guide covers installation for inference, training, and development.

Basic Installation

For inference and basic usage, install OpenCLIP via pip:
This installs the core package with dependencies for loading models and running inference.
The package name is open_clip_torch on PyPI, but you import it as open_clip in Python.

Optional Dependencies

Some models require additional packages depending on their architecture:

Image Encoders (timm)

Many modern models use timm-based image encoders (ConvNext, SigLIP, EVA, etc.). Install the latest timm for full model support:
If you see “Unknown model” errors for the image encoder, upgrade timm to the latest version:

Tokenizers (transformers)

Models that use Hugging Face transformers tokenizers require the transformers library:

Complete Installation

To install OpenCLIP with all optional dependencies:

Training Installation

For training CLIP models, install with training dependencies:
This includes additional packages for:
  • Distributed training
  • Data loading and augmentation
  • Logging and monitoring
  • WebDataset support
Training requires PyTorch to be installed separately. Follow the PyTorch installation guide for your specific system configuration.

Development Installation

For contributors or those who want to modify the code:
1

Create a virtual environment

First, create and activate a virtual environment:
2

Clone the repository

Clone the OpenCLIP repository:
3

Install in development mode

Install the package in editable mode:
Or install training dependencies:
4

Install PyTorch

Install PyTorch according to your system:

Testing Installation

To verify your installation and run tests:

Install test dependencies

Run all tests

Run specific tests

Verification

Verify your installation by loading a pretrained model:
If this runs without errors, your installation is complete.

Platform-Specific Notes

Linux

OpenCLIP works out of the box on most Linux distributions. For CUDA support, ensure you have:
  • NVIDIA drivers installed
  • CUDA toolkit matching your PyTorch version

macOS

OpenCLIP works on macOS with CPU or MPS (Apple Silicon) acceleration:

Windows

For Windows, we recommend using WSL2 (Windows Subsystem for Linux) for the best experience, especially for training. Native Windows installation works but may have some limitations.

Troubleshooting

Make sure you’re importing the correct name:
Reduce batch size or use gradient accumulation:
This usually means a timm model is not found. Upgrade timm:
Models are cached after first download. The cache location can be set:

Next Steps

Now that OpenCLIP is installed, proceed to the quickstart guide to run your first example:
  • Quickstart Guide - Run zero-shot classification
  • [Model Zoo(/usage/pretrained-models) - Browse available models
  • [Training Guide(/training/overview) - Train your own CLIP models